﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

using System.Web.Script.Services;
namespace JTicket.UI.Service
{
    /// <summary>
    /// Summary description for JT_ThSvc
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    [GenerateScriptType(typeof(JTicket.Model.C_TheaterInfo))]
    public class JT_ThSvc : System.Web.Services.WebService
    {
        [WebMethod] 
        public string IsRe(string flag)
        {
            bool b = false;
            BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
            string opercode = bllOper.Oper().OperCode;
            b = DAL.L_RePrintProc.ExcutRePint("", flag, opercode, "", "重打票审核");
            if (b)
                return "审核成功";
            else
                return "操作失败, 请重新操作。";
        }
        [WebMethod]
        public string IsRes(string flags)
        {
            BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
            bool b = false;
            string opercode = bllOper.Oper().OperCode;
            string[] thCode = flags.TrimEnd('|').Split('|');
            foreach (var code in thCode)
            {
                b = DAL.L_RePrintProc.ExcutRePint("", code, opercode, "", "重打票审核");

            }
            if (b)
                return "审核成功";
            else
                return "操作失败, 请重新操作。";
        }
         
        [WebMethod]
        public bool Exists(string ThCode)
        {
            return BLL.C_TheaterInfo.Exists(ThCode);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        [WebMethod]
        public string Add(JTicket.Model.C_TheaterInfo model)
        {
            if (!BLL.C_TheaterInfo.Exists(model.ThCode))
            {
               BLL.C_TheaterInfo.Add(model);
               return "添加成功！";
            }
            else
                return "该剧院编号已存在！";
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        [WebMethod]
        public string Update(JTicket.Model.C_TheaterInfo model)
        {

            if (BLL.C_TheaterInfo.Exists(model.ThCode))
            {
                 BLL.C_TheaterInfo.Update(model);
                return "修改成功！";
            }
            else
                return "该剧院不存在！";
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        [WebMethod]
        public void Delete(string ThCode)
        {
            BLL.C_TheaterInfo.Delete(ThCode);
        }
        [WebMethod]
        public void Deletes(string ThCode)
        {
            string[] thCode = ThCode.TrimEnd('|').Split('|');
            foreach (var code in thCode)
            {
                BLL.C_TheaterInfo.Delete(code);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        [WebMethod]
        public JTicket.Model.C_TheaterInfo GetModel(string ThCode)
        {
            BLL.C_TheaterInfo bllTheaterInfo = new BLL.C_TheaterInfo();
            return bllTheaterInfo.GetModel(ThCode);
        }


    }
}
